package threading;

import java.util.concurrent.BlockingDeque;
import java.util.concurrent.LinkedBlockingDeque;

 //阻塞队列
public class ThreadDemo20 {
    public static void main(String[] args) throws InterruptedException {
        BlockingDeque<String> blockingDeque = new LinkedBlockingDeque<>();
        blockingDeque.put("hello1");
        blockingDeque.put("hello2");
        blockingDeque.put("hello3");
        blockingDeque.put("hello4");
        blockingDeque.put("hello5");
        String result = null;
        result = blockingDeque.take();
        System.out.println(result);
        result = blockingDeque.take();
        System.out.println(result);
        result = blockingDeque.take();
        System.out.println(result);
        result = blockingDeque.take();
        System.out.println(result);
        result = blockingDeque.take();
        System.out.println(result);

        result = blockingDeque.take();
        System.out.println(result);
    }
}
